import http from '@/utils/http'
import {RolePageParams,RoleAddParams,ChangeState,ChangePermission} from './roleModel'
enum Api{
  pageParams='/role/page',
  saveParams='/role/save',
  updateParams='/role/update',
  removeParams='/role/remove',
  updateStateParams='/role/updateState',
  setPermissionParams='/role/setPermission',
}
/**
 * 修改角色权限
 */
export const roleSetPermissionApi=async (params:ChangePermission)=>{
  return http.post(Api.setPermissionParams,params)
}
/**
 * 修改角色状态
 */
export const roleUpdateStateApi=async(params:ChangeState)=>{
  return http.post(Api.updateStateParams,params)
}
/**
 * 删除角色
 */
export const roleRemoveApi=async(params)=>{
  return http.deleteApi(Api.removeParams,params)
}
/**
 * 编辑角色
 */
export const roleUpdateApi=async (params:RoleAddParams)=>{
  return http.post(Api.updateParams,params)
}
/**
 * 新增角色
 */
export const roleSaveApi=async (params:RoleAddParams)=>{
  return http.post(Api.saveParams,params)
}
/**
 * 
 * @param params 获取角色详情
 * @returns 
 */
export const rolePageApi = async(params:RolePageParams)=>{
  return http.get(Api.pageParams,params)
}